package controllers;

import java.util.Collection;
import java.util.LinkedList;

public class ManagerTask {
	public ManagerTask(TaskType taskType,DataListener listener,Object...arguments){
		this.inizializeArguments(arguments);
		this.listener=listener;
		this.type=taskType;
	}
	private void inizializeArguments(Object[] arguments){
		this.arguments=new LinkedList<Object>();
		if (arguments!=null){
			for(Object arg:arguments){
				this.arguments.add(arg);
			}
		}
	}
	public TaskType getTaskType(){
		return this.type;
	}
	public Collection<Object> getArguments(){
		return this.arguments;
	}
	public DataListener getDataListener(){
		return this.listener;
	}
	public boolean hasAborted(){
		return this.aborted;
	}
	public void abort(){
		this.aborted=true;
	}


	public static enum TaskType{
		/*Task di sistema*/
		SYSTEM_INSERT_SYS_USER,
		SYSTEM_SET_SYS_USER,
		
		/*Task di sessione*/
		USER_LOGIN,
		USER_LOGOUT,
		USER_PERMISSIONS,
		USER_REGISTER,
		USER_CURRENT,
		USER_MODIFY_PASSWORD,
		
		/*Task richiesta*/
		REQUEST_GET_ALL,
		REQUEST_REMOVE,
		REQUEST_SEND,
		REQUEST_ACCEPT,
		REQUEST_DENY,
		
		/*Task Servizi*/
		SERVICE_GET_ALL,
		SERVICE_ADD,
		SERVICE_MODIFY,
		SERVICE_REMOVE,
		
		/*Task preventivi*/
		BUDGET_GET_ALL,
		BUDGET_MODIFY,
		BUDGET_SEND,
		BUDGET_REMOVE,
				
		/*Task contratti eventi*/
		EVENT_CONTRACT_GET_ALL,
		EVENT_CONTRACT_SEND,
		EVENT_CONTRACT_REMOVE, 
		EVENT_CONTRACT_REVERT_TO_BUDGET,

		/*Task employee*/
		EMPLOYEE_CONTRACT_REGISTER,
		EMPLOYEE_CONTRACT_REMOVE,
		EMPLOYEE_CONTRACT_GET_ALL,
		EMPLOYEE_CONTRACT_SEND,
		
		/*Task Eventi*/
		EVENT_GET_ALL, 
		
		/*Task Transazioni*/
		TRANSACTION_GET_ALL,
		TRANSACTION_GET_STATS,
		TRANSACTION_SEND,
		TRANSACTION_PAY_WAGES,
		TRANSACTION_GET_WAGES_TRANSACTIONS,
	}
	private TaskType type;
	private boolean aborted=false;
	private LinkedList<Object> arguments;
	private DataListener listener;
}
